package com.xuexizu.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;

import com.xuexizu.entity.DesignerEntity;
import com.xuexizu.util.DBManager;
import com.xuexizu.util.QueryDataResult;

public class DesignerDaoImpl {
	public ArrayList<DesignerEntity> selectDesigner() {
		ArrayList<DesignerEntity> dList=new ArrayList<DesignerEntity>();
		String sqlString="select id,name,position,designer_img,join_time from designer;";
		QueryDataResult qResult=DBManager.executeQuery(sqlString);
		if(qResult!=null) {
			try {
				while(qResult.resultSet.next()) {
					dList.add(new DesignerEntity(qResult.resultSet.getInt("id"),
							qResult.resultSet.getString("name"),
							qResult.resultSet.getString("position"),
							qResult.resultSet.getString("designer_img"),
							qResult.resultSet.getDate("join_time")));
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		qResult.close();
		return dList;
	}
}
